Skip to content

LocalStorage for the browser and Node.js#41

Merged
frankebersoll merged 20 commits intomasterfrom
feature/storage
Feb 19, 2016
Merged

LocalStorage for the browser and Node.js#41
frankebersoll merged 20 commits intomasterfrom
feature/storage

Conversation

@frankebersoll
Copy link
Contributor

This is the (quite naive) implementation of local storage that uses window.localStorage in the browser and the file system in Node; see Issue #24

Configuration

client.config.useLocalStorage();

I can see making the event directory configurable for node - currently, it uses the default .exceptionless in the application's root directory.

Performance

This could be drastically improved by using caching and background processing. We could use a combination of in-memory cache and then write the events to the file system (or local storage, which also uses the file system) in batches, so the ui is blocked for only very short times. In Node, I use synchronous file access which probably could be changed to async.
The only thing being cached now is the list of event names together with their timestamps.

ToDo

  • Test
  • Discuss performance and optimizations
  • Use encoding of timestamp in keys
  • Default path for NodeFileStorage: .express relative to the application root path
  • Customizable path for NodeFileStorage
  • Submit existing events on startup
  • Check invariant culture for coordinates
  • Change node.js user agent

Content type is not enforced, and we use one common storage for heterogeneous data (events and configuration data).
- Added NodeFileStorage
- Added DevDependency: mock-fs (https://github.com/tschaub/mock-fs)
- Modified InMemoryStorage specs to work for both kinds of storage implementations
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overrides the Configuration.useLocalStorage stub for Node.

Put code from BrowserStorage and NodeFileStorage into common base class
}

readDate(key: string) {
return Date.now();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we get the tick count from the key?

let key = `ex-q-${new Date().toJSON()}-${Utils.randomNumber()}`;

@CLAassistant
Copy link

CLA assistant check
All committers have accepted the CLA.

@niemyjski
Copy link
Member

Looking good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants